export const historySearchModule = {
	namespaced: true,
	state: {
		//公共的变量，这里的变量不能随便修改，只能通过触发mutations的方法才能改变
		historySearchlist: uni.getStorageSync("historySearchlist") ? uni.getStorageSync("historySearchlist") : []
	},
	mutations: {
		//相当于同步的操作
		setHistorySearchlist(state, historySearchContent) {
			state.historySearchlist = state.historySearchlist.filter(item => item != historySearchContent)
			state.historySearchlist = state.historySearchlist.slice(-4)
			state.historySearchlist.push(historySearchContent)
			uni.setStorageSync("historySearchlist", state.historySearchlist)
		},
		cleanHistorySearchlist(state) {
			state.historySearchlist = []
			uni.removeStorageSync("historySearchlist")
		}
	},
	actions: {
		//相当于异步的操作,不能直接改变state的值，只能通过触发mutations的方法才能改变
	}
}